package com.my.chapter11;

import java.util.LinkedList;
import java.util.Queue;

public class practice27 {
    public static void main(String[] args) {
        P27 a = new P27();
        Queue<Command> queue = a.full();
        P27A b = new P27A();
        b.printQ(queue);
    }
}

class Command{
    String str;
    public Command(String str){
        this.str = str;
    }
    void operation(){
        System.out.print(str + " ");
    }
}

class P27{
    Queue<Command> full(){
        Queue<Command> queue = new LinkedList<Command>();
        queue.offer(new Command("A"));
        queue.offer(new Command("B"));
        queue.offer(new Command("C"));
        return queue;
    }
}

class P27A{
    void printQ(Queue<Command> queue){
        while(queue.peek()!=null){
            queue.remove().operation();
        }
        System.out.println("");
    }
}
